//     https://www.nowcoder.com/practice/fe6c73cb899c4fe1bdd773f8d3b42c3d



#include <cstddef>
#include <iostream>
using namespace std;

int GCD(int a, int b)
{
    while (a != 0 && b != 0)
    {
        int t = b;
        b = a % b;
        a = t;
    }
    return a;
}

int main()
{
    long long n, x;
    cin >> n >> x;

    for (int i = 0; i < n; i++)
    {
        int t;
        cin >> t;
        if (t <= x)  x += t;
        else  x += GCD(t, x);
    }

    cout << x << endl;
    return 0;
}